﻿using System;
using AMS.DataAccess.BO;
using AMS.DataAccess.BO.Enums;
using System.Collections.Generic;

namespace AMS.DataAccess.BO.Enums
{
    /// <summary>
    /// Summary description for EnumConverter
    /// </summary>
    public static class EnumConverter
    {
        private static volatile object syncObj = new object();
        private static Dictionary<CustomerType, string> CustomerTypeMapping;
        private static Dictionary<CustomerBusinessType, string> CustomerBusinessTypeMapping;

        public static string CustomerTypeToString(CustomerType cusType)
        {
            if (CustomerTypeMapping == null)
            {
                lock (syncObj)
                {
                    if (CustomerTypeMapping == null)
                    {
                        CustomerTypeMapping = new Dictionary<CustomerType, string>();
                        CustomerTypeMapping.Add(CustomerType.Unknown, "未知");
                        CustomerTypeMapping.Add(CustomerType.Personal, "个人客户");
                        CustomerTypeMapping.Add(CustomerType.Company, "公司客户");
                        CustomerTypeMapping.Add(CustomerType.Angency, "代理机构");
                    }
                }
            }

            return CustomerTypeMapping[cusType];
        }

        public static string CustomerBusinessTypeToString(CustomerBusinessType bizType)
        {
            if (CustomerBusinessTypeMapping == null)
            {
                lock (syncObj)
                {
                    if (CustomerBusinessTypeMapping == null)
                    {
                        CustomerBusinessTypeMapping = new Dictionary<CustomerBusinessType, string>();
                        CustomerBusinessTypeMapping.Add(CustomerBusinessType.Unspesified, "未说明");
                        CustomerBusinessTypeMapping.Add(CustomerBusinessType.Applicant, "申请人");
                        CustomerBusinessTypeMapping.Add(CustomerBusinessType.Client, "委托人");
                        CustomerBusinessTypeMapping.Add(CustomerBusinessType.ClientAndApplicant, "委托人兼申请人");
                    }
                }
            }

            return CustomerBusinessTypeMapping[bizType];
        }
    }
}
